{% extends 'siteAdmin/siteAdmin.html' %}

{% block operation %}
{% include 'siteAdmin/tinyPart.html' with context %}
<h1>Interfaccia di gestione Software</h1>

{% if req.path =='/siteAdmin/swAdd' %}
        <div id="box">
        {% if pageData['sw'].id %}
            <form  method="POST" action="/siteAdmin/swAdd?update={{pageData['sw'].id}}">
        {% else %}
            <form  method="POST" action="/siteAdmin/swAdd?add">
        {% endif %}
        <div class="row thin">
            <span class="word">Denominazione :</span>
            <span class="insert">
                <input name="denomination" type="text" style="width: 60%" value="{{pageData['sw'].denomination|nonone}}" tabindex="1"/></span><br />
        </div>
        <div class="row thin">
            <span class="word">Licenza :</span>
        <select name="license" style="width: 40%">
                    {% if pageData['sw'].license %}
                        <option value="{{pageData['sw'].license}}">{{pageData['sw'].license}}</option>
                    {% endif %}
                    <option value="Abandonware">Abandonware</option>
                    <option value="Adware">Adware</option>
                    <option value="Apache License">Apache License</option>
                    <option value="CeCILL">CeCILL</option>
                    <option value="Common Public Attribution License">Common Public Attribution License</option>
                    <option value="Common Public License">Common Public License</option>
                    <option value="Copyleft">Copyleft</option>
                    <option value="Copyright">Copyright</option>
                    <option value="EULA">EULA</option>
                    <option value="European Union Public Licence">European Union Public Licence</option>
                    <option value="Freeware">Freeware</option>
                    <option value="GNU Affero General Public License">GNU Affero General Public License</option>
                    <option value="GNU Free Documentation License">GNU Free Documentation License</option>
                    <option value="GNU General Public License">GNU General Public License</option>
                    <option value="GNU Lesser General Public License">GNU Lesser General Public License</option>
                    <option value="GNU Simpler Free Documentation License">GNU Simpler Free Documentation License</option>
                    <option value="GPL linking exception">GPL linking exception</option>
                    <option value="IBM Public License">IBM Public License</option>
                    <option value="Licenza ISC">Licenza ISC</option>
                    <option value="Licenza MIT">Licenza MIT</option>
                    <option value="Licenza artistica">Licenza artistica</option>
                    <option value="Licenze BSD">Licenze BSD</option>
                    <option value="Mozilla Public License">Mozilla Public License</option>
                    <option value="Pubblico dominio">Pubblico dominio</option>
                    <option value="Shareware">Shareware</option>
                    </select><br />
        </div>

        <div class="row thin">
            <span class="word">Open Source :</span>
            <select name="opensource">
                {% if pageData['sw'].id %}
                    {% if pageData['sw'].opensource %}
                        <option value="{{pageData['sw'].opensource}}">{{pageData['sw'].opensource}}</option>
                        <option value="False">NO</option>
                    {% else %}
                        <option value="{{pageData['sw'].opensource}}">{{pageData['sw'].opensource}}</option>
                        <option value="True">YES</option>
                    {% endif %}
                {% endif %}
                <option value="True">YES</option>
                <option value="False">NO</option>
            </select>
        </div>
        <div class="row thin">
            <span class="word">Release :</span>
            <span class="insert">
                <input name="versione" type="text" style="width: 60%" value="{{pageData['sw'].versione|nonone}}" tabindex="5"/></span><br />
        </div>
        <div class="row thin">
            <span class="word">Url :</span>
            <span class="insert">
                <input name="url" type="text" style="width: 60%" value="{{pageData['sw'].url|nonone}}" tabindex="6"/></span><br />
        </div>
        <div class="row thin">
            <span class="word">Email :</span>
            <span class="insert" >
                <input name="email" type="text" style="width: 60%" value="{{pageData['sw'].email|nonone}}"  tabindex="7" /></span><br /><br />
        </div><br /><br />
        <span class="word">Descrizione Breve ( max 500 caratteri ) :</span>
        <textarea name="abstract" type="text" rows="10" cols="50" style="width: 80%">{{pageData['sw'].abstract|nonone}}</textarea><br /><br />
        <span class="word">Descrizione Software ( si possono mettere video, foto ) </span>
        <textarea name="description" rows="30" cols="50" style="width: 90%">{{pageData['sw'].description|nonone}}</textarea>

                <div class="row lineTop">
                <span class="word">Seleziona la cat. software:</span>
                    <select name="categoriaId" style="width: 60%" size="7" multiple="multiple">
                    {% for cate in pageData['menuSoftwareCategory'] %}
                    {% if cate.denominazione == pageData['sw'].categ.denominazione %}
                        <option value="{{cate.id}}" SELECTED >{{cate.denominazione}}</option>
                    {% else %}
                    <option value="{{cate.id}}">{{cate.denominazione}}</option>
                    {% endif %}
                    {% endfor %}
                    </select>
                    </div>
                <div class="row "><br />

                <span class="word">Seleziona la lingua:</span>
                    <select name="languageId">
                    {% if pageData['sw'].lang %}
                    <option selected="yes" value="{{pageData['sw'].lang.id}}">{{pageData['sw'].lang.denominazione}}</option>
                    {% endif %}
                    {% for lang in pageData['language'] %}}
                    <option value="{{lang.id}}">{{lang.denominazione}}</option>
                    {% endfor %}
                    </select>
                    </div><br />
                <div style="height:110px;">
                <img src="/templates/software_img/{{pageData['sw'].imagepath}}.jpg?{{pageData['now']}}" alt="{{pageData['sw'].title}}" class="img_left" /><br /><br />
                <a HREF="/siteAdmin/fileupload?id={{pageData['sw'].id}}&amp;part=swAdd"
                    onClick="return targetopener(this)">Aggiungi o modifica la icona del software</a></div>
            <br /><br />
                <input type="submit" class="wymupdate" value="Aggiungi"/>
            </form>
            <br />
        </div>

    {% elif req.path =='/siteAdmin/swList' %}
        <div id="box">
                <span class="testa"><h2>Gestione SoftWare</h2></span>
                <hr></hr>
                <div class="row normal">
                <a href="/siteAdmin/swAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi una News" title="aggiungi una News"/>
                </a>
                </div>
                {% for page in pageData['sws'] %}
                <div class="row normal lineTop" >
                    <span>{{page.denomination}}({{page.lang.denominazione_breve}})</span>
                    <span class="image"><a href="/siteAdmin/swDel?swId={{page.id}}" onClick='return confirm("Sei sicuro di voler cancellare questo software?")' ><img src="/templates/siteAdmin/img/trash.png" alt="elimina la news" title="elimina la news"/></a></span>
                    <span class="image"><a href="/siteAdmin/swAdd?edit={{page.id}}"><img src="/templates/siteAdmin/img/modifica.png" alt="modifica un software" title="modifica un software"/></a></span>
            {% if page.active==1 %}
            <span class="image normal" >
                <a href="/siteAdmin/swActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_on.png" alt="disattiva Azienda" title="disattiva Software"/>
                </a>
            </span>
            {% endif%}
            {% if page.active==0 %}
            <span class="image normal">
                <a href="/siteAdmin/swActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_off.png" alt="attiva Azienda" title="attiva Software"/>
                </a>
            </span>
            {% endif%}
                </div>
                {% endfor %}
            <ul class="pages">
                <li class="prima">Software:</li>
                {% for i in range(0,pageData['item']) %}
                    {% if i != pageData['pag'] %}
                        <li><a href="/siteAdmin/swList?pag={{i+1}}">{{i+1}}</a></li>
                    {% else %}
                        <li>[<a href="/siteAdmin/swList?pag={{i+1}}">{{i+1}}</a>]</li>
                    {% endif %}
                {% endfor %}
            </ul>
                <div class="row normal lineTop">
                <a href="/siteAdmin/companyAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi un software" title="aggiungi un software"/>
                </a>
                </div>
        </div>
{% endif %}
        </div>
{%endblock%}
